package com.glowworms.system.service;

import java.util.List;

import com.glowworms.core.exception.ServiceException;
import com.glowworms.core.util.PaginationUtil;

/**
 * 
 * @author Tkk
 *
 */
public interface CommonService {
	
	/**
	 * 通用保存数据 
	 * @param <T>
	 * @param t
	 * @return
	 */
	public <T> boolean save(T t) throws ServiceException;
	
	/**
	 * 通用修改数据
	 * @param <T>
	 * @param t
	 * @return
	 * @throws ServiceException
	 */
	public <T> boolean modify(T t) throws ServiceException;
	
	/**
	 * 通用删除数据
	 * @param <T>
	 * @param t
	 * @return
	 * @throws ServiceException
	 */
	public <T> boolean delete(T t) throws ServiceException;
	
	/**
	 * 查询所有数据
	 * @param <T>
	 * @param t
	 * @return
	 * @throws ServiceException
	 */
	public <T> List<T> queryAll(T t) throws ServiceException;
	
	/**
	 * 查询分页数据
	 * @param <T>
	 * @param paginationUtil
	 * @return
	 * @throws ServiceException
	 */
	public <T> PaginationUtil<T> queryPagination(PaginationUtil<T> paginationUtil) throws ServiceException;
	
	/**
	 * 查询分页数据
	 * @param <T>
	 * @param currentPage	查询页
	 * @param pageSize		每页多少条
	 * @return
	 * @throws ServiceException
	 */
	public <T> PaginationUtil<T> queryPagination(final int currentPage, final int pageSize) throws ServiceException;
}
